package com.example.makerspace.controller;

import com.example.makerspace.aop.Log;
import com.example.makerspace.dto.DemandDTO;
import com.example.makerspace.dto.PageRequest;
import com.example.makerspace.dto.Result;
import com.example.makerspace.service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@ResponseBody
@RequestMapping("/api/audit")
@Api(tags = "后台审核员模块")
public class AuditController {
    @Resource
    private AdminService adminService;

  private  final  static  String   testHttpPrefix="https://119.45.199.13:3035/static/";
    private  final  static  String  devHttpPrefix="https://nism.ytcata.com:443/static/";
    @ApiOperation(value="产品模块-产品列表",notes ="产品模块-产品列表")
    @PostMapping("/listProducts")
    public Result listProducts(@RequestBody PageRequest pageRequest){
        return  adminService.listProducts(pageRequest);
    }
    @Log("产品模块-编辑产品(包括审核产品)")
    @ApiOperation(value="产品模块-编辑产品(包括审核产品)",notes ="产品模块-产品(包括审核产品)")
    @PostMapping("/updateProducts")
    public  Result updateProducts(@ModelAttribute DemandDTO demandDTO){
        return  adminService.updateProducts(demandDTO);
    }

    @ApiOperation(value="产品模块-产品信息页接口",notes ="产品模块-产品信息页接口")
    @GetMapping("/detailProduct")
    public  Result detailProduct(Integer id,Integer type){
        return  adminService.detailProduct(id,type);
    }
    @Log("产品模块-删除产品")
    @ApiOperation(value="产品模块-删除产品",notes ="产品模块-删除产品")
    @GetMapping("/deleteProducts")
    public  Result deleteProducts(@RequestParam("id") Integer id){
        return  adminService.deleteProducts(id);
    }
}
